/*
 * NormalInvoiceHolder.java
 * business
 *
 * Created by ChenTao on 2017/1/5.
 *
 * Copyright (c) 2017年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.widget.listview.viewholder;

import android.view.View;
import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.yidiandao.business.R;
import com.yidiandao.business.data.bean.NormalInvoice;
import com.yidiandao.business.ui.widget.listview.ViewHolder;

/** 普通发票 ViewHolder */
public class NormalInvoiceHolder extends ViewHolder {

    public LinearLayout rootSetDefault;
    public TextView tvDelete;
    public TextView tvEdit;
    private TextView tvName;
    private CheckBox cbToDefault;

    @Override
    protected void initView(View rootView) {
        tvName = (TextView) rootView.findViewById(R.id.tv_name);
        rootSetDefault = (LinearLayout) rootView.findViewById(R.id.root_set_default);
        tvDelete = (TextView) rootView.findViewById(R.id.tv_delete);
        tvEdit = (TextView) rootView.findViewById(R.id.tv_edit);
        cbToDefault = (CheckBox) rootView.findViewById(R.id.cb_to_default);
    }

    @Override
    protected int getItemLayoutId() {
        return R.layout.item_normal_invoice;
    }

    public void refreshUI(NormalInvoice invoice) {
        tvName.setText(invoice.getInvTitle());
        cbToDefault.setChecked(invoice.isSelected());
    }
}
